package components.scenes;

import java.util.List;

import com.uqbar.vainilla.GameScene;
import components.CollisionableComponent;
import components.ComponentsHashTable;

public abstract class  CollisionablesScene extends GameScene {
	private ComponentsHashTable componentsTable;

	public CollisionablesScene(int tableQuadrantSize, int tableWidth, int tableHeight){
		this.componentsTable = new ComponentsHashTable(tableQuadrantSize, tableWidth, tableHeight);
	}
	
	public void setComponentsTable(ComponentsHashTable componentsTable) {
		this.componentsTable = componentsTable;
	}

	public ComponentsHashTable getComponentsTable() {
		return componentsTable;
	}
	
	public void addCollisionable(CollisionableComponent gc){
		this.addComponent(gc);
		this.getComponentsTable().addCollisionableComponent(gc, gc.getX(), gc.getY());
	}
	public void addCollisionables(List<CollisionableComponent> ccs){
		for (CollisionableComponent cc : ccs){
			this.addCollisionable(cc);
		}
	}
	
	public void removeCollisionable(CollisionableComponent gc){
		this.getComponentsTable().remove(gc, gc.getX(), gc.getY());
		gc.destroy();
		this.removeComponent(gc);

	}


}
